#include <iostream>
using std::cout;
using std::endl;
//TODO:stack singleton
class Point {
public:
    static  Point &get_instance (int x,int y){
        static Point pt(x,y);
        return pt;
    }

    Point(const Point &) = delete;
    Point & operator=(const Point &) = delete;

    void print(){
        cout<<_x<<":"<<_y<<endl;
    }
private:
    Point(int x,int y)
        :_x(x)
        ,_y(y) 
    {}

    int _x;
    int _y;
};


void test(){
    Point &p1 = Point ::get_instance(1,2);
    Point &p2 = Point ::get_instance(2,3);//第二次无法再初始化
    p1.print();
    p2.print();
   // Point p3;
   // Point p4(1,2);
   // Point p5 = p1;

}

int main()
{


    test ();
    return 0;
}

